package com.agency8x.controller;

import java.util.ArrayList;
import java.util.List;

import com.agency8x.config.AppConf;
import com.agency8x.model.AuthRoleModel;
import com.agency8x.model.AuthRuleModel;
import com.agency8x.model.LoginModel;
import com.agency8x.model.base.BaseMenuItemModel;
import com.jfinal.core.Controller;

/**
 * 接口页控制器
 * 
 * @author SoChishun
 *
 */
public class ApisController extends Controller {
	/**
	 * 获取菜单
	 */
	public void getMenu() {
		// 获取用户登录信息
		LoginModel loginInfo = LoginModel.getLoginInfo(this, AppConf.loginSessionID);
		if(null==loginInfo){
			return;
		}
		List<BaseMenuItemModel> list = AuthRuleModel.me.getMenus(loginInfo.getUserId());
		this.renderJson(list);
	}

	public void getRole() {
		List<AuthRoleModel> list = AuthRoleModel.me.getRoles();
		this.renderJson(list);
	}
}
